home *** CD-ROM | disk | FTP | other *** search
/ PC World Komputer 2010 April / PCWorld0410.iso / hity wydania / Ubuntu 9.10 PL / karmelkowy-koliberek-desktop-9.10-i386-PL.iso / casper / filesystem.squashfs / usr / lib / python2.6 / dummy_threading.pyc (.txt) < prev    next >
Python Compiled Bytecode  |  2009-11-11  |  1KB  |  61 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. '''Faux ``threading`` version using ``dummy_thread`` instead of ``thread``.
  5.  
  6. The module ``_dummy_threading`` is added to ``sys.modules`` in order
  7. to not have ``threading`` considered imported.  Had ``threading`` been
  8. directly imported it would have made all subsequent imports succeed
  9. regardless of whether ``thread`` was available which is not desired.
  10.  
  11. '''
  12. from sys import modules as sys_modules
  13. import dummy_thread
  14. holding_thread = False
  15. holding_threading = False
  16. holding__threading_local = False
  17.  
  18. try:
  19.     if 'thread' in sys_modules:
  20.         held_thread = sys_modules['thread']
  21.         holding_thread = True
  22.     
  23.     sys_modules['thread'] = sys_modules['dummy_thread']
  24.     if 'threading' in sys_modules:
  25.         held_threading = sys_modules['threading']
  26.         holding_threading = True
  27.         del sys_modules['threading']
  28.     
  29.     if '_threading_local' in sys_modules:
  30.         held__threading_local = sys_modules['_threading_local']
  31.         holding__threading_local = True
  32.         del sys_modules['_threading_local']
  33.     
  34.     import threading
  35.     sys_modules['_dummy_threading'] = sys_modules['threading']
  36.     del sys_modules['threading']
  37.     sys_modules['_dummy__threading_local'] = sys_modules['_threading_local']
  38.     del sys_modules['_threading_local']
  39.     from _dummy_threading import *
  40.     from _dummy_threading import __all__
  41. finally:
  42.     if holding_threading:
  43.         sys_modules['threading'] = held_threading
  44.         del held_threading
  45.     
  46.     del holding_threading
  47.     if holding__threading_local:
  48.         sys_modules['_threading_local'] = held__threading_local
  49.         del held__threading_local
  50.     
  51.     del holding__threading_local
  52.     if holding_thread:
  53.         sys_modules['thread'] = held_thread
  54.         del held_thread
  55.     else:
  56.         del sys_modules['thread']
  57.     del holding_thread
  58.     del dummy_thread
  59.     del sys_modules
  60.  
  61.